#pragma once

#include "Utilities.h"

namespace ZeEngine
{
	class GameEngine;
    class IComponentSystem;
    class EntityManager;
    class ISDLWindow;
    class ResourceManager;
    class Event;

	class IGameState
	{
        friend class GameEngine;

	public:

        IGameState();
        virtual ~IGameState() {}

        virtual bool Init(GameEngine& gameEngine) { return true; }
        virtual void PreUpdate(GameEngine& gameEngine) {}
        virtual bool Update(GameEngine& gameEngine) { return false; }
        virtual void PostUpdate(GameEngine& gameEngine) {}
        virtual void Destroy(GameEngine& gameEngine) {}

        virtual void StateIn() {};
        virtual void StateOut() {};

        IComponentSystem* AddSystem(std::unique_ptr<IComponentSystem> pSystemToAdd);

    private:

        bool InitSystems(GameEngine& gameEngine);
        void PreUpdateSystems(GameEngine& gameEngine);
        bool UpdateSystems(GameEngine& gameEngine);
        void PostUpdateSystems(GameEngine& gameEngine);
        void DestroySystems(GameEngine& gameEngine);
        void RenderSystems(SDL_Renderer& renderer, GameEngine& gameEngine, float interpolation);

    private:
        std::vector<std::unique_ptr<IComponentSystem>> m_systems;
	};
}